import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core';
import { Hero, HeroArg } from 'src/app/configs/types';
import { HeroService } from 'src/app/services/hero.service';

@Component({
  selector: 'app-heros',
  templateUrl: './heros.component.html',
  styleUrls: ['./heros.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class HerosComponent implements OnInit {
  searchParams: HeroArg = {
    name: '',
    job: '',
    sort: 'desc'
  };
  showSpin = false;
  heros: Hero[];
  // heroServe: HeroService;
  constructor(readonly heroServe: HeroService) {
    // this.heroServe = new HeroService();
    this.heros = this.heroServe.getHeros();
    console.log('hero service test--', this.heroServe.getHeros());
  }

  ngOnInit(): void { }

  search() {
    console.log('test--', this.searchParams);
  }
}
